package com.gzx.risk.core.apis.result.huarong;

import com.gzx.risk.core.apis.result.RiskResult;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.util.Map;

@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class HuarongC9005 extends RiskResult {
    private String code;
    private String message;
    private Map<String, Object> data;
    private String signature;

    public String getValue(String key) {
        if (data == null) {
            return "";
        }
        if (data.containsKey(key)) {
            return data.get(key).toString();
        } else {
            return "";
        }
    }

    /**
     * 检查接口调用是否成功
     * @return 是否成功
     */
    public boolean isSuccess() {
        return "0000".equals(code);
    }

    /**
     * 该报告尚未生成,请稍后再试
     * @return 中间等待状态
     */
    public boolean isWaiting() {
        return "B0013".equals(code);
    }
}
